API Documentation
Public Member Functions | List of all members
nkGraphics::ShaderManager Class Referencefinal

Manages the sahders available in the component. More...

Inheritance diagram for nkGraphics::ShaderManager:

Public Member Functions

 ~ShaderManager ()
 
bool isBuiltInShader (Shader *toTest)
 
ShadercreateOrRetrieve (const std::string_view &name)
 
Shaderget (const std::string_view &name)
 
ShadergetByIndex (unsigned int index)
 
void rename (const std::string_view &oldName, const std::string_view &newName)
 
void erase (const std::string_view &name)
 

Detailed Description

Manages the sahders available in the component.

The manager is responsible for the allocated memory it returns. External code should never delete returned memory.

Constructor & Destructor Documentation

◆ ~ShaderManager()

nkGraphics::ShaderManager::~ShaderManager ( )

Destructor.

Member Function Documentation

◆ isBuiltInShader()

bool nkGraphics::ShaderManager::isBuiltInShader ( Shader toTest)

Checks whether a shader is built-in, aka offered by the component as a default solution.

Parameters
toTestThe shader to test.
Returns
If the shader is built-in (true) or not (false).

◆ createOrRetrieve()

Shader* nkGraphics::ShaderManager::createOrRetrieve ( const std::string_view &  name)

Creates if unavailable, or retrieve if available, a shader.

Parameters
nameThe name of the shader to retrieve.
Returns
Requested shader, possibly freshly created. The manager owns the memory alloated, external memory should not delete it. See eraseShader().

◆ get()

Shader* nkGraphics::ShaderManager::get ( const std::string_view &  name)

Retrieves an existing shader.

Parameters
nameThe name of the shader to retrieve.
Returns
The shader if available, nullptr else.

◆ getByIndex()

Shader* nkGraphics::ShaderManager::getByIndex ( unsigned int  index)

Retrieves a shader by index. Note that an index can point to different shaders as the memory of the manager is changed. Useful to loop over all available shaders in one go.

Parameters
indexThe index of the shader to retrieve.
Returns
The shader linked if available, nullptr else.

◆ rename()

void nkGraphics::ShaderManager::rename ( const std::string_view &  oldName,
const std::string_view &  newName 
)

Renames a shader, changing both its name and the way to find it in the manager.

Parameters
oldNameThe name of the shader to alter.
newNameThe new name to assign.

◆ erase()

void nkGraphics::ShaderManager::erase ( const std::string_view &  name)

Erases a shader and frees its memory.

Parameters
nameThe name of the shader to erase.

The documentation for this class was generated from the following file: